home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 2003 August / MW 8 2003 CD1.iso / Inside Macworld / Product News / gimp-1.2.4.sit / gimp-1.2.4 / plug-ins / script-fu / scripts / basic1-logo.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2003-02-27  |  3.0 KB  |  82 lines

  1. ;  DROP-SHADOW-LOGO
  2. ;  draw the specified text over a background with a drop shadow
  3.  
  4. (define (apply-basic1-logo-effect img
  5.                   logo-layer
  6.                   bg-color
  7.                   text-color)
  8.   (let* ((width (car (gimp-drawable-width logo-layer)))
  9.      (height (car (gimp-drawable-height logo-layer)))
  10.      (bg-layer (car (gimp-layer-new img width height RGBA_IMAGE "Background" 100 NORMAL)))
  11.      (shadow-layer (car (gimp-layer-new img width height RGBA_IMAGE "Shadow" 100 MULTIPLY)))
  12.      (old-fg (car (gimp-palette-get-foreground)))
  13.      (old-bg (car (gimp-palette-get-background))))
  14.     (gimp-selection-none img)
  15.     (script-fu-util-image-resize-from-layer img logo-layer)
  16.     (gimp-image-add-layer img shadow-layer 1)
  17.     (gimp-image-add-layer img bg-layer 2)
  18.     (gimp-palette-set-foreground text-color)
  19.     (gimp-layer-set-preserve-trans logo-layer TRUE)
  20.     (gimp-edit-fill logo-layer FG-IMAGE-FILL)
  21.     (gimp-palette-set-background bg-color)
  22.     (gimp-edit-fill bg-layer BG-IMAGE-FILL)
  23.     (gimp-edit-clear shadow-layer)
  24.     (gimp-selection-layer-alpha logo-layer)
  25.     (gimp-palette-set-background '(0 0 0))
  26.     (gimp-selection-feather img 7.5)
  27.     (gimp-edit-fill shadow-layer BG-IMAGE-FILL)
  28.     (gimp-selection-none img)
  29.     (gimp-palette-set-foreground '(255 255 255))
  30.     (gimp-blend logo-layer FG-BG-RGB MULTIPLY RADIAL 100 20 REPEAT-NONE FALSE 0 0 0 0 width height)
  31.     (gimp-layer-translate shadow-layer 3 3)
  32.     (gimp-palette-set-background old-bg)
  33.     (gimp-palette-set-foreground old-fg)))
  34.  
  35. (define (script-fu-basic1-logo-alpha img
  36.                      logo-layer
  37.                      bg-color
  38.                      text-color)
  39.   (begin
  40.     (gimp-undo-push-group-start img)
  41.     (apply-basic1-logo-effect img logo-layer bg-color text-color)
  42.     (gimp-undo-push-group-end img)
  43.     (gimp-displays-flush)))
  44.  
  45. (script-fu-register "script-fu-basic1-logo-alpha"
  46.             _"<Image>/Script-Fu/Alpha to Logo/Basic I..."
  47.             "Creates a simple logo with a drop shadow"
  48.             "Spencer Kimball"
  49.             "Spencer Kimball"
  50.             "1996"
  51.             "RGBA"
  52.                     SF-IMAGE      "Image" 0
  53.                     SF-DRAWABLE   "Drawable" 0
  54.             SF-COLOR      _"Background Color" '(255 255 255)
  55.             SF-COLOR      _"Text Color" '(6 6 206))
  56.  
  57. (define (script-fu-basic1-logo text
  58.                    size
  59.                    font
  60.                    bg-color
  61.                    text-color)
  62.   (let* ((img (car (gimp-image-new 256 256 RGB)))
  63.      (text-layer (car (gimp-text-fontname img -1 0 0 text 10 TRUE size PIXELS font))))
  64.     (gimp-image-undo-disable img)
  65.     (gimp-layer-set-name text-layer text)
  66.     (apply-basic1-logo-effect img text-layer bg-color text-color)
  67.     (gimp-image-undo-enable img)
  68.     (gimp-display-new img)))
  69.  
  70. (script-fu-register "script-fu-basic1-logo"
  71.             _"<Toolbox>/Xtns/Script-Fu/Logos/Basic I..."
  72.             "Creates a simple logo with a drop shadow"
  73.             "Spencer Kimball"
  74.             "Spencer Kimball"
  75.             "1996"
  76.             ""
  77.             SF-STRING     _"Text" "The Gimp"
  78.             SF-ADJUSTMENT _"Font Size (pixels)" '(100 2 1000 1 10 0 1)
  79.             SF-FONT       _"Font" "-*-Dragonwick-*-r-*-*-24-*-*-*-p-*-*-*"
  80.             SF-COLOR      _"Background Color" '(255 255 255)
  81.             SF-COLOR      _"Text Color" '(6 6 206))
  82.